﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Safe_Driving.TokenUser;
using System.Data;

namespace Safe_Driving
{
    public partial class MainWindow
    {
        public void RemplirExamens()
        {
            SingletonTokenUser token = SingletonTokenUser.GetInstance();
            AppSafeDriving app = (AppSafeDriving)token.DbApp;

            lblNomClient.Content = token.Client_selected.NoM.ToUpper() + " " + token.Client_selected.PreNoM;
           
            var query = from ex in app.SFExamEn
                        join p in app.SFPasse on ex.IDExamEn equals p.IDExamEn
                        where p.IDClient == token.Client_selected.IDClient
                        orderby p.DatePassage descending
                        select new { ex.IDExamEn, ex.NoM, ex.Date };

            dgvExamens.ItemsSource = query;
        }
    }
}
